<?php
	class RegisterView {
		
		
		private $m_triedToRegister = "TriedToRegister";
		private $m_triedToReturn = "TriedToReturn";
		
		private $m_getEmail = "Email";
		private $m_getFirstName = "FirstName";
		private $m_getLastName = "LastName";
		private $m_getDateOfBirth = "DateOfBirth";
		private $m_getPassword = "Password";
		private $m_getSecPassword = "SecPassword";
		
		public function DoRegistrationForm() {
			return "
		<div id='registerBox'>
			<form method='post'>
				<fieldset>
					<legend>Enter information!</legend>
					
					<p><label for='email'>e-mail:</label></p>
					<input class='textBox' type='text' id='email' name='$this->m_getEmail' >
					
					<p><label for='firstName'>First name:</label></p>
					<input class='textBox' type='text' id='firstName' name='$this->m_getFirstName' >
					
					<p><label for='lastName'>Last name:</label></p>
					<input class='textBox' type='text' id='lastName' name='$this->m_getLastName' >
					
					<p><label for='dateOfBirth'>Date of birth:</label></p>
					<input class='textBox' type='text' id='dateOfBirth' name='$this->m_getDateOfBirth' >
				</fieldset>
				<div id='passwordBox' >
					<fieldset>
						<legend>Enter your password!</legend>
						<p><label for='password'>Password:</label></p>
						<input class='textBox' type='text' id='password' name='$this->m_getPassword' >
						<p><label for='secPassword'>Repeat password:</label></p>
						<input class='textBox' type='text' id='secPassword' name='$this->m_getSecPassword' >
					</fieldset>
				</div>
				<p>
					<input class='button' type='submit' value='Register' name='$this->m_triedToRegister' >
				</p>
				
			</form>
		</div>
		<a class='return' href='index.php' title='Return to login' ></a>
		";
		}
		
		public function DoRegisterdPage(){
			return "
		<div id='RegisterSuccess' title='Go to login page'>
			<h2>You are now registered!</h2>
			<a href='index.php' >click here to go to the login page!</a>
		</div>";
		}
		//Tar hand om information
		public function GetEmail(){
			return (isset($_POST[$this->m_getEmail]) ? $_POST[$this->m_getEmail] : FALSE);
		}
		public function GetFirstName(){
			return (isset($_POST[$this->m_getFirstName]) ? $_POST[$this->m_getFirstName] : FALSE);
		}
		public function GetLastName(){
			return (isset($_POST[$this->m_getLastName]) ? $_POST[$this->m_getLastName] : FALSE);
		}
		public function GetDateOfBirth(){
			return (isset($_POST[$this->m_getDateOfBirth]) ? $_POST[$this->m_getDateOfBirth] : FALSE);
		}
		public function GetPassword(){
			if(isset($_POST[$this->m_getPassword]) === TRUE &&
			 		 $_POST[$this->m_getSecPassword] == $_POST[$this->m_getPassword]){
			 		 	return $_POST[$this->m_getPassword];
					 }
			return FALSE;
		}
		
  		//kollar om användaren försöker registrera sig
  		public function TriedToRegister() {
			return (isset( $_POST[$this->m_triedToRegister]) ? TRUE : FALSE);
  		}
	}
?>